/** 
 * Name:    Tooltip JS
 * Version: 1.0.00 (2012-09-03)
 * Author:  Oliekh Iaroslav
 */


if (!tooltip) { 
	var tooltip = {
		tooltip_h : 300,
		tooltip_w : 500,
		delta_left_x : -50,
		delta_right_x : -250,
		delta_top_y : 48,		
		delta_bottom_y : -208,
		open : function (id, x, y) {	
			var window_h = getWindowHeight();
			var window_w = getWindowWidth();
			var delta_x = this.delta_left_x;
			var delta_y = this.delta_top_y;
			
			if(y > (window_h/2 + 0)) delta_y = this.delta_bottom_y;	
			if(x > (window_w/2 + 200)) delta_x = this.delta_right_x;		
			
			$('#'+id+' .pointer').hide();
			if(delta_x == this.delta_left_x && delta_y == this.delta_top_y) $('#'+id+' .pointer.lt').show();
			else if(delta_x == this.delta_left_x && delta_y == this.delta_bottom_y) $('#'+id+' .pointer.lb').show();
			else if(delta_x == this.delta_right_x && delta_y == this.delta_top_y) $('#'+id+' .pointer.rt').show();
			else if(delta_x == this.delta_right_x && delta_y == this.delta_bottom_y) $('#'+id+' .pointer.rb').show();
			
		
			$('#'+id).attr('style', 'top: '+(y + delta_y)+'px; left: '+(x + delta_x)+'px;')							
			$('#'+id).show();			
		},	
		close : function()
		{
			$('.my-tooltip').hide();		
		}
	}
}


$(document).ready(function(){
	var mouse_down_x, mouse_down_y;
	
	$('#map').mousedown(function(e){
		alert(e.pageX);
	});
	
});

